{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import OnePyPlus as op\n",
    "from event_engine import EVENT, EventEngine\n",
    "\n",
    "\n",
    "class Environment:\n",
    "    cleaners: dict = {}\n",
    "    strategies: dict = {}\n",
    "    risk_managers: dict = {}\n",
    "\n",
    "\n",
    "class Luffy(op.StrategyBase):\n",
    "\n",
    "    def __init__(self, name):\n",
    "        super().__init__(name)\n",
    "        self.save_to_env(self)\n",
    "\n",
    "    def handle_bar(self):\n",
    "        # self.buy(20, \"000001\", 0, 0.1, 0, 0, 0, 0, 0, 0)\n",
    "        self.buy(ticker=\"000001\", size=20, takeprofit=0.03)\n",
    "        # print(66)\n",
    "        # self.buy(20, \"000001\", 0, 0.01, 0, 0, 0, 0, 0, 0.01)\n",
    "        # self.short(5, \"000001\",0,0.1,0,0,0,0.01,0,0)\n",
    "        # self.print_position()\n",
    "\n",
    "    # def run(self):\n",
    "        # self.handle_bar()\n",
    "\n",
    "\n",
    "luffy = Luffy(\"hahahaha\")\n",
    "# op.save_strategy(luffy)\n",
    "\n",
    "go = op.OnePiece()\n",
    "op.CsvReader(\"/Users/chandler/Documents/CLionProjects/OnePyPlus/data/\",\n",
    "             \"000001\", \"000001\")\n",
    "\n",
    "go.set_stock_backtest(100000, 0, 0.0016, 0.1)\n",
    "\n",
    "go.set_date(\"2017-02-05\", \"2017-04-01\", \"D\", \"A_shares\")\n",
    "\n",
    "\n",
    "go.sunny(True)\n",
    "\n",
    "# op.print_balance()\n",
    "# print(luffy.env)\n",
    "env = luffy.get_env()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2017-04-01 00:00:00'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "env.sys_date"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "pd.DataFrame()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
